package com.example.kothin_study.dao

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

fun main() {
//    var start=System.currentTimeMillis()
//    runBlocking {
////        println("codes run in coroutine scope")
////        delay(1500)
////        println("finished running")
//        repeat(100000){
//            launch{
//                printDot()
//            }
//
//        }
//
//    }
//    var end=System.currentTimeMillis()
//    println("time: ${end-start}ms")
    runBlocking {
        coroutineScope {
            for(i in 1..10){
                println(i)
                delay(1000)
            }
            println("coroutineScope Finished") // this line will be printed after 10 seconds
            delay(1000)
        }
        println("RunBlocking finished")  // this line will be printed immediately after the coroutine finishes
        delay(1000)
    }
    println("main finished")










}
suspend fun printDot() = coroutineScope {
    launch {
        println(".")
        delay(1000)
    }
}





